﻿using B.S.Medical.Domain.Department;
using B.S.Medical.Domain.Doctor;

namespace B.S.Medical.Api.Read.DTOS
{
    /// <summary>
    /// 医生排班信息DTO（用于一周排班表格展示）
    /// </summary>
    public class DoctorScheduleDto
    {
        /// <summary>
        /// 排班Id
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 医生Id
        /// </summary>
        public int DoctorId { get; set; }
        /// <summary>
        /// 医生名称
        /// </summary>
        public string DoctorName { get; set; }
        /// <summary>
        /// 科室Id（冗余字段，便于查询）
        /// </summary>
        public int DepartmentId { get; set; }
        /// <summary>
        /// 科室名称
        /// </summary>
        public string DepartmentName { get; set; }
        /// <summary>
        /// 排班日期
        /// </summary>
        public DateTime ScheduleDate { get; set; }
        /// <summary>
        /// 时段（1=上午，2=下午）
        /// </summary>
        public int Period { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }
        /// <summary>
        /// 是否接诊（true=接诊，false=休息）
        /// </summary>
        public bool IsAvailable { get; set; }
        /// <summary>
        /// 预约数量（已预约人数）
        /// </summary>
        public int AppointmentCount { get; set; }
        /// <summary>
        /// 号源数（可预约总数）
        /// </summary>
        public int  SlotCount{ get; set; }
        /// <summary>
        /// 医生实体（可选，便于扩展）
        /// </summary>
        public DoctorModel? Doctor { get; set; }
        /// <summary>
        /// 科室实体（可选，便于扩展）
        /// </summary>
        public ManageModel? Department { get; set; }
    }

    /// <summary>
    /// 医生某天排班详情DTO（用于日历点击详情/设置）
    /// </summary>
    public class DoctorDayScheduleDto
    {
        /// <summary>
        /// 医生Id
        /// </summary>
        public int DoctorId { get; set; }
        /// <summary>
        /// 医生名称
        /// </summary>
        public string DoctorName { get; set; }
        /// <summary>
        /// 科室名称
        /// </summary>
        public string DepartmentName { get; set; }
        /// <summary>
        /// 上午排班详情
        /// </summary>
        public DayPeriodDetailDto AM { get; set; }
        /// <summary>
        /// 下午排班详情
        /// </summary>
        public DayPeriodDetailDto PM { get; set; }
    }

    /// <summary>
    /// 单个时段（上午/下午）排班详情DTO
    /// </summary>
    public class DayPeriodDetailDto
    {
        /// <summary>
        /// 接诊时间段（如 8:00-12:00）
        /// </summary>
        public string TimeRange { get; set; } // 如 8:00-12:00
        /// <summary>
        /// 号源数（可预约总数）
        /// </summary>
        public int SlotCount { get; set; }
        /// <summary>
        /// 预约数量（已预约人数）
        /// </summary>
        public int AppointmentCount { get; set; }
        /// <summary>
        /// 是否接诊（true=接诊，false=休息）
        /// </summary>
        public bool IsAvailable { get; set; }
    }
}
